Skip to content

fix(scan): preserve snapshot id for empty data evolution index plans - #258

Open
wangyong9999 wants to merge 7 commits into
apache:mainfrom
wangyong9999:fix/data-evolution-empty-plan-snapshot-20260828
Open

fix(scan): preserve snapshot id for empty data evolution index plans#258
wangyong9999 wants to merge 7 commits into
apache:mainfrom
wangyong9999:fix/data-evolution-empty-plan-snapshot-20260828

Conversation

@wangyong9999

@wangyong9999 wangyong9999 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Purpose

Linked issue: none.

A global-index miss returned an empty plan without the snapshot ID used by the scan.

Internal index results: keep the snapshot ID used to evaluate the Global Index and attach it to
an empty plan. If latest advances before data planning, fail instead of combining index ranges and
data splits from different snapshots.

Externally supplied empty results: do not infer snapshot provenance from the result. Run normal
batch planning to resolve and validate the selected data snapshot, then retain that snapshot ID and
drop the splits.

Unsupported time travel: when a supplied Global Index result is present, or a non-partition
predicate may use the Global Index, reject effective tag- and timestamp-based startup modes before
index evaluation. Explicit snapshot IDs and latest modes remain supported; missing selectors keep
the normal Invalid errors.

This adds no shared state, public API, ABI, storage-format, or protocol changes.

Tests

  • paimon-global-index-test: 138/138 passed.
  • paimon-core-test: 1874/1874 passed.
  • Regression coverage includes internal and pre-supplied empty results, effective startup-mode
    selector precedence, missing or invalid snapshot selection, strict tag/timestamp rejection, and
    normal time travel when no Global Index path is requested.
  • clang-format 20.1.8, cpplint 2.0.2, codespell, and git diff --check passed.

API and Format

None.

Documentation

None.

Generative AI tooling

Generated-by: OpenAI Codex (GPT-5)

Comment thread src/paimon/core/table/source/data_evolution_batch_scan.cpp Outdated
@wangyong9999
wangyong9999 force-pushed the fix/data-evolution-empty-plan-snapshot-20260828 branch from aeeb00a to cd817b9 Compare September 1, 2026 14:15
Comment thread src/paimon/core/table/source/data_evolution_batch_scan.cpp
…view-fixes-20260901

# Conflicts:
#	src/paimon/core/table/source/data_evolution_batch_scan.cpp
Comment thread src/paimon/core/table/source/data_evolution_batch_scan.cpp Outdated
snapshot_reader_->GetSnapshotManager();
PAIMON_ASSIGN_OR_RAISE(std::optional<Snapshot> snapshot,
ResolveGlobalIndexScanSnapshot(core_options_, snapshot_manager));
if (!snapshot) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If global_index_result_ is set externally, how do we infer its snapshot ID? In that case, using ResolveGlobalIndexScanSnapshot does not seem very appropriate.

I’d suggest being stricter here: if predicates are present with global index, we should either reject time travel options such as timestamp/tag, or properly implement the corresponding support like java, rather than adding defensive checks in multiple places.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7400330. Supplied empty results now take the selected snapshot from normal batch planning; we no longer infer it through a separate resolver. Tag/timestamp are rejected before evaluating a Global Index candidate, and the shared scanner change is removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants